using System;

namespace Mbs.Log
{
    /// <summary>
    /// 日志工厂类
    /// </summary>
    public class LoggerManager
    {
        public virtual ILog CreateLogger(Type type)
        {
            return new DebugLogger { Name = type.Name };
        }

        public virtual ILog CreateLogger(string name)
        {
            return new DebugLogger { Name = name };
        }

        protected LoggerManager() { }

        private static LoggerManager instance = null;
        public static LoggerManager Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new LoggerManager();
                }
                return instance;
            }
            set
            {
                instance = value;
            }
        }

        public static ILog GetLogger(Type type)
        {
            return Instance.CreateLogger(type);
        }

        public static ILog GetLogger(string name)
        {
            return Instance.CreateLogger(name);
        }
    }
}
